<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

/**
 * @package App\Http\Controllers\Api
 * @see SquareController
 */
class SquareController extends BaseController
{

    /**
     * attentionList
     * @uri /square/attention-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"last_id":"A0B75EACDCCAFE25"}
     * @response {"success":true,"statusCode":200,"result":{"has_more":true,"list":[{"id":"24\u4f4d\u52a8\u6001ID","created_at":1604632694,"target_type":1,"user":{"id":"24\u4f4d\u7528\u6237ID","avatar":"default.png","nickname":"\u542c\u541b031233"},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","is_deleted":0,"count":{"like":0,"collect":0}},"note":{"id":"24\u4f4d\u7b14\u8bb0ID","content":"\u7b14\u8bb0\u5185\u5bb9","type":"\u7b14\u8bb0\u7c7b\u578b\uff0c1\u6587\u7ae0\u7b14\u8bb0\uff0c2\u6587\u7ae0\u5212\u7ebf\u7b14\u8bb0\uff0c3\u6587\u672c\u7c7b\u7b14\u8bb0","selected":"\u6587\u7ae0\u8282\u9009\u5185\u5bb9\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","start_index":1,"end_index":2,"article":{"id":"24\u4f4d\u6587\u5b57ID","title":"\u6587\u5b57\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981","is_deleted":0}}}]},"message":"OK"}
     */
    public function attentionList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"has_more":true,"list":[{"id":"24\u4f4d\u52a8\u6001ID","created_at":1604632694,"target_type":1,"user":{"id":"24\u4f4d\u7528\u6237ID","avatar":"default.png","nickname":"\u542c\u541b031233"},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","is_deleted":0,"count":{"like":0,"collect":0}},"note":{"id":"24\u4f4d\u7b14\u8bb0ID","content":"\u7b14\u8bb0\u5185\u5bb9","type":"\u7b14\u8bb0\u7c7b\u578b\uff0c1\u6587\u7ae0\u7b14\u8bb0\uff0c2\u6587\u7ae0\u5212\u7ebf\u7b14\u8bb0\uff0c3\u6587\u672c\u7c7b\u7b14\u8bb0","selected":"\u6587\u7ae0\u8282\u9009\u5185\u5bb9\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","start_index":1,"end_index":2,"article":{"id":"24\u4f4d\u6587\u5b57ID","title":"\u6587\u5b57\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981","is_deleted":0}}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

    /**
     * recommendList
     * @uri /square/recommend-list
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     * @request {"last_id":"BF9F7A6C3E62266F"}
     * @response {"success":true,"statusCode":200,"result":{"has_more":true,"list":[{"id":"24\u4f4d\u52a8\u6001ID","created_at":1604632694,"target_type":1,"user":{"id":"24\u4f4d\u7528\u6237ID","avatar":"default.png","nickname":"\u542c\u541b031233"},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","is_deleted":0,"count":{"like":0,"collect":0}},"note":{"id":"24\u4f4d\u7b14\u8bb0ID","content":"\u7b14\u8bb0\u5185\u5bb9","type":"\u7b14\u8bb0\u7c7b\u578b\uff0c1\u6587\u7ae0\u7b14\u8bb0\uff0c2\u6587\u7ae0\u5212\u7ebf\u7b14\u8bb0\uff0c3\u6587\u672c\u7c7b\u7b14\u8bb0","selected":"\u6587\u7ae0\u8282\u9009\u5185\u5bb9\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","start_index":1,"end_index":2,"article":{"id":"24\u4f4d\u6587\u5b57ID","title":"\u6587\u5b57\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981","is_deleted":0}}}]},"message":"OK"}
     */
    public function recommendList(Request $request)
    {
        $params = $request->all();

        // @todo api data from mock.
        $mock = json_decode(
            mb_convert_encoding(
                '{"success":true,"statusCode":200,"result":{"has_more":true,"list":[{"id":"24\u4f4d\u52a8\u6001ID","created_at":1604632694,"target_type":1,"user":{"id":"24\u4f4d\u7528\u6237ID","avatar":"default.png","nickname":"\u542c\u541b031233"},"article":{"id":"24\u4f4d\u6587\u7ae0ID","title":"\u6587\u7ae0\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","is_deleted":0,"count":{"like":0,"collect":0}},"note":{"id":"24\u4f4d\u7b14\u8bb0ID","content":"\u7b14\u8bb0\u5185\u5bb9","type":"\u7b14\u8bb0\u7c7b\u578b\uff0c1\u6587\u7ae0\u7b14\u8bb0\uff0c2\u6587\u7ae0\u5212\u7ebf\u7b14\u8bb0\uff0c3\u6587\u672c\u7c7b\u7b14\u8bb0","selected":"\u6587\u7ae0\u8282\u9009\u5185\u5bb9\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","start_index":1,"end_index":2,"article":{"id":"24\u4f4d\u6587\u5b57ID","title":"\u6587\u5b57\u6807\u9898","cover_url":"\u5c01\u9762\u56fe\uff0c\u53ef\u80fd\u4f4d\u7a7a\u503c","description":"\u6458\u8981","is_deleted":0}}}]},"message":"OK"}'
                , 'UTF-8', 'UTF-8,GBK,GB2312,BIG5' )
            , true
        );
        $data = $mock['result'];

        return $this->apiReturn($data);
    }

}